﻿#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include <stdlib.h>
#include<time.h>
void u() {
	printf("********************************\n");
	printf("********* 开始游戏--1 **********\n");
	printf("********* 结束游戏--0 **********\n");
	printf("********************************\n");
}
void t() {
	int r = rand() % 100 + 1;
	int a=0;
	printf("开始:");
	while (1) {
		scanf("%d", &a);
		if (a > r)
			printf("猜大了\n");
		else if (a < r)
			printf("猜小了\n");
		else
		{
			printf("恭喜，猜对了");
			break;
		}
	}
}
int main() {
	u();
	int i=0;
	srand((unsigned int)time(NULL));
	do {
		scanf("%d", &i);
		switch(i){
		case 1: t();
			break;
		case 0: printf("结束游戏\n");
			break;
		default:
			printf("选择错误，重新选择\n");
			break;
		}
	} while (i);
	return 0;
}


